﻿using System;
using System.Windows.Forms;

namespace mLabControls
{
    public class mLabForm : Form
    {
        private string prijevod;

        public string Prijevod
        {
            get { return prijevod; }
            set { prijevod = value; }
        }

        public mLabForm() : base()
        {
            this.KeyPreview = true;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.KeyUp += new KeyEventHandler(mLabFormKeyUp);
            this.Paint += new System.Windows.Forms.PaintEventHandler(this.Prevedi);
        }

        public void mLabFormKeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape) this.Close();
        }

        protected void Prevedi(object sender, PaintEventArgs e)
        {
            string text;
            try
            {
                text = TranslateLabela.Prevedi(this.prijevod);
                this.Text = text;
            }
            catch
            {
            }
        }   
    }
}
